package br.ufrj.ppgi.greco.util;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import br.com.caelum.vraptor.ioc.Component;
import br.com.caelum.vraptor.ioc.ComponentFactory;

@Component
public class UtilEntityManager implements ComponentFactory<EntityManager>
{
	private final EntityManagerFactory emf;

	public UtilEntityManager()
	{
		emf = Persistence.createEntityManagerFactory("default");
	}

	public EntityManager getInstance()
	{
		return emf.createEntityManager();
	}

}
